<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>购物车</title>
	<link rel="stylesheet" type="text/css" href="./Public/Home/css/shop.css"/>
	<script src="./Public/Home/js/jquery.min1.9.js" type="text/javascript" charset="utf-8"></script>
	<script src="./Public/Home/js/index.js" type="text/javascript" charset="utf-8"></script>
    <script>
        $(function(){
            $('.minus').click(function () {
                var num=parseInt($(this).siblings(".number").val())||0;
                num=num-1;
                num=num<1?1:num;
                $(this).siblings(".number").val(num);
                var data = {};
                data.id = $(this).attr('id');
                data.nums = $(this).siblings(".number").val();
                $.ajax({
                    type:"post",
                    url:"<?php echo U('Cart/idet')?>",
                    data:data,
                    dataType:"text",
                    success:function (phpData) {
                        $('.g .buy-menu .cart-fee ul .cart-fee-data1').html(phpData);
                        num = 0;
                        for(i=0;i<$('.number').length;i++){
                            num = Number($('.number').eq(i).val()) + Number(num);
                        }
                        $('.main-content .wrapper .brick-bottom .g .buy-menu .cart-fee ul .cart-fee-data').html(num);
                    }
                })

            })
            $('.plus').click(function () {
                var num=parseInt($(this).siblings(".number").val())||0;
                $(this).siblings(".number").val(num+1);
                var data = {};
                data.id = $(this).attr('id');
//                alert(data.id);
                data.nums = $(this).siblings(".number").val();
                $.ajax({
                    type:"post",
                    url:"<?php echo U('Cart/idet')?>",
                    data:data,
                    dataType:"text",
                    success:function (phpData) {
                        $('.g .buy-menu .cart-fee ul .cart-fee-data1').html(phpData);
                        num = 0;
                        for(i=0;i<$('.number').length;i++){
                            num = Number($('.number').eq(i).val()) + Number(num);
                        }
                        $('.main-content .wrapper .brick-bottom .g .buy-menu .cart-fee ul .cart-fee-data').html(num);
                    }
                })
            })

        })
    </script>
    <script>
        $(function () {

        })
    </script>

</head>
<body>
	<!--头部条开始-->
			
	<!--头部条开始-->
	<div id="header">
		<div class="center">
			<!--左部分开始-->
			<ul class="left">
				<li class="gi1">
					<a href="javascript:;">社区</a>
				</li>
				<li class="gi2">
					<a href="javascript:;">ColorOS</a>
				</li>
				<li class="gi3">
					<a href="javascript:;">软件商店</a>
				</li>
				<li class="gi4">
					<a href="javascript:;">手机助手</a>
				</li>
				<li class="gi5">
					<a href="javascript:;">云服务</a>
				</li>
			</ul>
			<!--左部分结束-->
			
			<!--右部分开始-->
			<ul class="right">
				<li class="gi1">
                                    
					    <a href="http://localhost/opposhop/index.php?m=Home&c=User&a=index">nihao</a>
                    				</li>
				<li class="gi2">
                                    
                    <a href="http://localhost/opposhop/index.php?m=Home&c=Login&a=out">退出</a>
                    				</li>
				
			</ul>
		</div>
	</div>
	<!--头部条结束-->
	
	<!--导航区域开始-->
	<div id="dh">
		<div id="wrapper">
		<div id="logo">
			<img src="./Public/Home/images/oppo_logo.png"/>
		</div>
		<div class="shop">

			<span class="text"><a href="http://localhost/opposhop/index.php?m=Home&c=Cart&a=index">购物车</a></span>
			<span class="icon"></span>
			<span class="num"> 
				<span class="shop-count">
					0
				</span>
			</span>
		</div>
		<ul class="nav">
				<li class="gi1">
					<a href="index.php"  >首页</a>
				</li>
							<li class="gi2" >
					<a href="http://localhost/opposhop/index.php?m=Home&c=List&a=index&cid=1" >手机</a>
				</li>
				</div>
	</div>
	<!--导航区域结束-->
	<div class="main-content ">
		<div class="wrapper">
			<ul class="breadcrumb">
				<li>
					<a href="">首页</a>
					<span>/</span>
				</li>
				<li>
					购物车
				</li>
			</ul>
			<div class="brick-bottom">
				<ul class="steps">
					<li class="one">
						<div class="step-content">
							<h5 class="step-heading">购物车</h5>
							<div class="step-gradient"></div>
						</div>
					</li>
					<!--<div class="after"></div>-->
					
					<li class="two">
						<div class="step-content">
							<h5 class="step-heading">填写账单</h5>
							<div class="step-gradient"></div>
						</div>
					</li>
<!--					<div class="after"></div>-->

					<li class="there">
						<div class="step-content">
							<h5 class="step-heading">填写账单</h5>
							<div class="step-gradient"></div>

						</div>
					</li>
					<div class="after"></div>
				</ul>
				<form action="" method="post" class="g">
					<ul class="purchase-list-header">
						<li class="first">

								<span class="all">
									商品信息
								</span>
						</li>
						<li class="second">产品</li>
						<li class="third">数量</li>
						<li class="four">单价</li>
						<li class="five">操作</li>
					</ul>
					
					<h2 class="buy-menu">
                        <?php if(!empty($_SESSION['cart']['goods'])){?>
                
                            <?php foreach ($_SESSION['cart']['goods'] as $k=>$v){?>
                                <div class="details">
                                <div class="cart-product-choice">
                                    <a href="" class="cart-product-image">
                                        <img src="./Public/Home/images/shouji1.jpg" style="width: 104px;height: 120px;"/>
                                    </a>
                                </div>
                                <div class="cart-product-info">
                                    <div class="cart-product-description">
                                        <h3 class="heading">
                                            <a href=""><?php echo $v['name']?></a>
                                            <?php foreach ($v['options']['type'] as $value){?>
                                                <p class="p"><?php echo $value?></p>
                                            <?php }?>
                                        </h3>
                                    </div>


                                    <div class="lap-one">
                                        <div class="wrapper">
                                            <div class="counter-box">
                                                <a  href="javascript:;" id="<?php echo $k?>"class="minus" style="color: black;">-</a>
                                                <input type="text" value="<?php echo $v['num']?>" class="number" />
                                                <a href="javascript:;" id="<?php echo $k?>" class="plus" style="color: black;">+</a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="cart-product-price">
                                        <?php if(!empty($v['options']['oldPrice'])){?>
                
                                            <span class="reduced" style="font-size: 18px;">￥<?php echo $v['options']['oldPrice']?></span>
                                        
               <?php }?>
                                        <strong style="font-size: 18px;">￥<?php echo $v['price']?></strong>
                                        <br />
                                        <span class="icon-reduced">官网促销</span>
                                    </div>
                                    <div class="del">
                                        <a href="<?php echo U('Cart/index',array('del'=>$k))?>" class="delete" style="font-size: 18px;color: black;">删除</a>
                                    </div>
                                </div>
                            </div>
                            <?php }?>
                        <?php }else{?>
                            <div class="null" style="margin-left: 386px;padding-top: 20px;padding-bottom:20px;font-size: 32px;">购物车是空的，去<a href="<?php echo U('Index/index')?>"style="color: #1f8657;">逛逛</a>吧</div>
                        
               <?php }?>
                        <?php if(!empty($_SESSION['cart']['goods'])){?>
                
                            <div class="cart-fee">

                                    <ul>
                                        <li>
                                            <span class="cart-fee-title">
                                                商品数量：
                                            </span>
                                            <span class="cart-fee-data"><?php echo Cart::getTotalNums()?></span>
                                        </li>

                                        <li>
                                            <span class="cart-fee-title">
                                                小计：
                                            </span>
                                            <span class="cart-fee-data1"><?php echo  Cart::getTotalPrice();?></span>
                                        </li>
                                    </ul>


                            </div>
                        
               <?php }?>
						<div class="form-actions">
							<div class="form-actions-left">
								<a href="<?php echo U('List/index')?>">继续购买>></a>
							</div>
							<div class="form-actions-right">
                                <?php if(!empty($_SESSION['cart']['goods'])){?>
                
                                    <button class="jiesuan">
                                        <?php if(!isset($_SESSION['username'])){?>
                
                                            <a href="<?php echo U('Login/index')?>">结算</a>
                                        <?php }else{?>
                                            <a href="<?php echo U('From/index')?>">结算</a>
                                        
               <?php }?>
                                    </button>
                                
               <?php }?>

                            </div>
						</div>
					</div>

				</form>
			</div>
		</div>

	</div>
    <!--公共底部-->
     	<!--公共底部-->
	<div id="foot-pic">
		<div id="gi">
			<span id="img">
			</span>
			<span id="text">
				OPPO社区
			</span>
		</div>
		
		<div id="gi1">
			<span id="img">
			</span>
			<span id="text">
				ColorOS
			</span>
		</div>
		
		<div id="gi2">
			<span id="img">
			</span>
			<span id="text">
				软件商店
			</span>
		</div>		
	</div>
	
	<div id="sitemap">
		<div class="wrapper">
			<div id="gi">
				<ul class="gi1">
					<span class="h_write">
						推荐机型
					</span>
					<ul class="gi2">
													<li><a href="http://localhost/opposhop/index.php?m=Home&c=Goods&a=index&gid=16">R9Plus金 大屏续航旗舰</a></li>
													<li><a href="http://localhost/opposhop/index.php?m=Home&c=Goods&a=index&gid=21">R9金 1600W前置自拍</a></li>
													<li><a href="http://localhost/opposhop/index.php?m=Home&c=Goods&a=index&gid=18"> A37玫瑰金 美颜4.0</a></li>
													<li><a href="http://localhost/opposhop/index.php?m=Home&c=Goods&a=index&gid=19">A59 闪速正面指纹识别</a></li>
											</ul>
				</ul>		
			</div>
			
			<div id="gi">
				<ul class="gi1">
					<span class="h_write">
						在线购买
					</span>

					<ul class="gi2">
											<li><a href="http://localhost/opposhop/index.php?m=Home&c=List&a=index&cid=1">手机</a></li>
										</ul>
				</ul>		
			</div>
			
			<div id="gi">
				<ul class="gi1">
					<span class="h_write">
						会员中心
					</span>
					<ul class="gi2">
						<li><a href="http://localhost/opposhop/index.php?m=Home&c=Login&a=index">会员登录</a></li>
						<li><a href="http://localhost/opposhop/index.php?m=Home&c=Login&a=zhuce">会员注册</a></li>
					</ul>
				</ul>		
			</div>		
		</div>
	</div>
	
	<div id="footer-tools">
		<div class="wrapper">
			<div class="h-wrapper">
				<span class="text">关注我们</span>
				<span class="icon">
					<img src="./Public/Home/images/weibo.png" style="width: 43px;height: 42px;"/>
				</span>
				<span class="icon1">
					<img src="./Public/Home/images/weixin.png" style="width: 43px;height: 42px;"/>
					<img class="img100" src="./Public/Home/images/erweima.png"/>										
				</span>
					<span class="text1">加入我们</span>
					<span class="text1">采购相关</span>				
			</div>
			
			<div class="h-subscribe">
				<span class="icon">
					<img src="./Public/Home/images/kefu.png"/>
				</span>
				<div class="about">
					<h4 class="h-delta">在线客服</h4>
					<p class="write">人工服务：8:30~22:00</p>
					<p class="write">24小时智能机器人服务</p>
					
				</div>	
				
				<span class="icon">
					<img src="./Public/Home/images/phone.png"/>
				</span>
				<div class="about">
					<h4 class="h-delta">4001-666-888</h4>
					<p class="write">7*24小时客服电话</p>
				</div>	
			</div>	
		</div>
	</div>
	<div id="bottom">
		<div class="center">
			<p class="bottom-info">© 2005 - 2016 东莞市永盛通信科技有限公司 | 版权所有 粤ICP备14056724号-2 | 联系方式：4001-666-888</p>
		</div>
	</div>
	

	

	
	



</body>
</html>